const http = require('http');
const server = http.createServer();
server.on('request', (req, res) => {
    // req.url 是客户端请求的地址
    const url = req.url;
    // req.method 是客户端的请求的method的类型
    const method = req.method;
    const str = `your request url is ${url}, and request method is ${method}`;
    console.log(str);
    // 调用res.end方法向客户端响应内容
    res.end(str);
});
server.listen(80, () => {
  console.log('server running at http://127.0.0.1');
});